package presenter;

import base.BasePresenter;
import base.ResultCallBack;
import bean.CodeBean;
import bean.GuangGaoBean;
import model.GuangGaoModel;
import model.MissPassModel;
import view.GuangGaoView;
import view.MissPassView;

/**
 * Created by Windows on 2019/11/5.
 */

public class MissPassPresenter extends BasePresenter<MissPassView> {
    private MissPassModel model;

    public MissPassPresenter() {
        this.model=new MissPassModel();
        addModel(model);
    }

    //请求修改密码接口
    public void requestFindpass(String phone,String y_pass,String c_pass,String code) {
        model.requestFindpass(new ResultCallBack<Void>() {
            @Override
            public void onSuccess(Void voiddata) {
                if (mView!=null)
                    mView.onSuccess(voiddata);

            }

            @Override
            public void onFail(String error) {
                if (mView!=null)
                mView.showToast(error);
                mView.onFail(error);

            }
        },phone,y_pass,c_pass,code);

    }

    //请求验证码接口
    public void requestYanzhengma(String phone,String type) {
        model.requestYanzhengma(new ResultCallBack<CodeBean>() {
            @Override
            public void onSuccess(CodeBean codeBean) {
                if (mView!=null)
                    mView.onSuccessCode(codeBean);
            }

            @Override
            public void onFail(String error) {
                if (mView!=null)
                    mView.showToast(error);
                mView.onFail(error);
            }
        },phone,type);
    }
}
